package quickcheck

import common._

import org.scalacheck._
import Arbitrary._
import Gen._
import Prop._

abstract class QuickCheckHeap extends Properties("Heap") with IntHeap {

  property("min1") = forAll { a: Int =>
    val h = insert(a, empty)
    findMin(h) == a
  }
  
  property("1 - min of two") = forAll { p: Pair[Int, Int] =>
    val h1 = insert(p._1, empty)
    val h2 = insert(p._2, h1)
    findMin(h2) == Math.min(p._1, p._2)
  }
  
  property("2 - delete min - heap with one item") = forAll { a: Int =>
    val h1 = insert(a, empty)
    val h2 = deleteMin(h1)
    isEmpty(h2)
  }
  
  //property("3 - heap sort") = forAll { a: Int =>
    //true
  //}
  
  //property("4 - meld") = forAll { other: IntHeap =>
    //true
  //}

  lazy val genHeap: Gen[H] = ???

  implicit lazy val arbHeap: Arbitrary[H] = Arbitrary(genHeap)

}
